package com.test.oauth2;

import com.test.mapper.SysOauthMapper;
import com.test.pojo.SysOauthClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

@Service
public class SysOauthClientService {

    @Autowired
    private SysOauthMapper sysOauthMapper;

    /**
     * 根据客户端id获取数据
     *
     * @param clientId
     * @return
     */
    public SysOauthClient findByClientId(String clientId) {
        SysOauthClient sysOauth = sysOauthMapper.selectOneByClientId(clientId);
        Assert.notNull(sysOauth, () -> {
            throw new RuntimeException("客戶端id为空");
        });
        System.out.println(sysOauth);
        return sysOauth;
    }
}
